<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>numdifftools</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th bgcolor="#70b0f0" class="navbar-select"
          >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/numdifftools/">numdifftools</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        Package&nbsp;numdifftools
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="numdifftools-module.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== PACKAGE DESCRIPTION ==================== -->
<h1 class="epydoc">Package numdifftools</h1><p class="nomargin-top"><span class="codelink"><a href="numdifftools-pysrc.html">source&nbsp;code</a></span></p>
<h1 class="heading">NUMDIFFTOOLS</h1>
    <p>Suite of tools to solve automatic numerical differentiation problems
    in one or more variables. All of these methods also produce error 
    estimates on the result. A pdf file is also provided to explain the 
    theory behind these tools.</p>
    <p>To test if the toolbox is working paste the following in an 
    interactive python session:</p>
<pre class="literalblock">
  import numdifftools as nd
  nd.test(coverage=True)
</pre>
    <h2 class="heading">Derivative:</h2>
      <p>A flexible tool for the computation of derivatives of order 1 
      through 4 on any scalar function. Finite differences are used in an 
      adaptive manner, coupled with a Romberg extrapolation methodology to 
      provide a maximally accurate result. The user can configure many of 
      the options, changing the order of the method or the extrapolation, 
      even allowing the user to specify whether central, forward or 
      backward differences are used.</p>
    <h2 class="heading">Gradient</h2>
      <p>Computes the gradient vector of a scalar function of one or more 
      variables at any location.</p>
    <h2 class="heading">Jacobian</h2>
      <p>Computes the Jacobian matrix of a vector (or array) valued 
      function of one or more variables.</p>
    <h2 class="heading">Hessian</h2>
      <p>Computes the Hessian matrix of all 2nd partial derivatives of a 
      scalar function of one or more variables.</p>
    <h2 class="heading">Hessdiag</h2>
      <p>The diagonal elements of the Hessian matrix are the pure second 
      order partial derivatives.</p>
    <h2 class="heading">Examples</h2>
      <p>Compute 1'st and 2'nd derivative of exp(x), at x == 1:</p>
<pre class="literalblock">
   &gt;&gt;&gt; import numpy as np
   &gt;&gt;&gt; import numdifftools as nd
   &gt;&gt;&gt; fd = nd.Derivative(np.exp)              # 1'st derivative
   &gt;&gt;&gt; fdd = nd.Derivative(np.exp, n=2)  # 2'nd derivative
   &gt;&gt;&gt; fd(1)
   array([ 2.71828183])
</pre>
      <p>Nonlinear least squares:</p>
<pre class="literalblock">
   &gt;&gt;&gt; xdata = np.reshape(np.arange(0,1,0.1),(-1,1))
   &gt;&gt;&gt; ydata = 1+2*np.exp(0.75*xdata)
   &gt;&gt;&gt; fun = lambda c: (c[0]+c[1]*np.exp(c[2]*xdata) - ydata)**2
   &gt;&gt;&gt; Jfun = nd.Jacobian(fun)
   &gt;&gt;&gt; np.abs(Jfun([1,2,0.75])) &lt; 1e-14 # should be numerically zero
   array([[ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True],
          [ True,  True,  True]], dtype=bool)
</pre>
      <p>Compute gradient of sum(x**2):</p>
<pre class="literalblock">
   &gt;&gt;&gt; fun = lambda x: np.sum(x**2)
   &gt;&gt;&gt; dfun = nd.Gradient(fun)
   &gt;&gt;&gt; dfun([1,2,3])
   array([ 2.,  4.,  6.])
</pre>
    <h2 class="heading">See also</h2>
      <p>scipy.misc.derivative</p>

<!-- ==================== SUBMODULES ==================== -->
<a name="section-Submodules"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Submodules</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Submodules"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
  <tr><td class="summary">
  <ul class="nomargin">
    <li> <strong class="uidlink"><a href="numdifftools.core-module.html">numdifftools.core</a></strong>: <em class="summary">Numdifftools implementation</em>    </li>
    <li> <strong class="uidlink"><a href="numdifftools.info-module.html">numdifftools.info</a></strong>: <em class="summary">Suite of tools to solve automatic numerical differentiation 
        problems in one or more variables.</em>    </li>
    <li> <strong class="uidlink"><a href="numdifftools.license-module.html">numdifftools.license</a></strong>: <em class="summary">New BSD</em>    </li>
    <li> <strong class="uidlink"><a href="numdifftools.nd_algopy-module.html">numdifftools.nd_algopy</a></strong>: <em class="summary">Easy to use interface to derivatives in algopy</em>    </li>
    <li> <strong class="uidlink"><a href="numdifftools.nd_scientific-module.html">numdifftools.nd_scientific</a></strong>: <em class="summary">Easy to use interface to derivatives in ScientificPython 
        http://dirac.cnrs-orleans.fr/ScientificPython/ScientificPythonManual/</em>    </li>
  </ul></td></tr>
</table>

<br />
<!-- ==================== VARIABLES ==================== -->
<a name="section-Variables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-Variables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="__package__"></a><span class="summary-name">__package__</span> = <code title="'numdifftools'"><code class="variable-quote">'</code><code class="variable-string">numdifftools</code><code class="variable-quote">'</code></code>
    </td>
  </tr>
</table>
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th bgcolor="#70b0f0" class="navbar-select"
          >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://code.google.com/p/numdifftools/">numdifftools</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Sat May 05 22:01:06 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
